<?php
namespace app\index\controller;

use app\admin\model\Tags;
use think\Controller;

class Index extends Common
{
    public function Index()
    {
       $article_select_result = db("article")->order('update_time','desc')->paginate(4);
        $aticles_date= $article_select_result->toArray();
        $articles=array_chunk($aticles_date['data'],2);//分割数组
       $this->assign('article',$articles);
        $this->assign('aticles_page',$article_select_result);
        return view();
    }

    public function tags($id = '')
    {
        $tags_model= new Tags();
        $tags_model_get=$tags_model->get($id);
        if($tags_model_get){
            $tags_model_get->article;
            $this->assign('article',$tags_model_get['article']);
            return view();
        }else{
            $this->error('非法传参','index/index/index');
        }

    }
}
